package com.fdy.code.enums;

import com.fdy.code.entity.FreemarkerInfo;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author fangdy
 * @date 2023-06-14 9:12
 */
@AllArgsConstructor
@Getter
public enum FreemarkerTemplateEnum {
    DEFAULT_TEMPLATE(TypeNameEnum.TYPE_ONE.getCode(),
            new FreemarkerInfo("entity.ftl","dao.ftl","mapper.ftl","service.ftl",
                    "serviceImpl.ftl","swaggerConfig.ftl","controller.ftl",
                    "abstractController")),
    DEFAULT_TWO(TypeNameEnum.TYPE_TWO.getCode(),
            new FreemarkerInfo("entity.ftl","dao.ftl","mapper.ftl","service.ftl",
                    "serviceImpl.ftl","swaggerConfig.ftl","controller.ftl",
                    "abstractController"));
    private String code;
    private FreemarkerInfo freemarkerInfo;

    public static FreemarkerTemplateEnum getTemplateType(String type){
        for (FreemarkerTemplateEnum value : FreemarkerTemplateEnum.values()) {
            if (value.getCode().equals(type)){
                return value;
            }
        }
        return FreemarkerTemplateEnum.DEFAULT_TEMPLATE;
    }

}
